// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import App from './App';
import Util from './util/utils';
import iView from 'iview';
import router from './router';
import {$get, $post} from 'util/request';
import 'iview/dist/styles/iview.css';
import './style/common.css';

Vue.prototype.$get = $get;
Vue.prototype.$post = $post;


Vue.use(iView);
Vue.config.productionTip = false;

/**
 * 换每个页面title
*/
router.beforeEach((to, from, next) => {
    Util.title(to.meta.title);
    next();
});

router.afterEach((to, from, next) => {
    window.scrollTo(0, 0);
});

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    template: '<App/>',
    components: { App }
})
